package first_practice;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @author ZhiWen Ren
 * @version 1.0
 * @description: LeetCode-101-对称二叉树
 * @date 2025/4/3 16:49
 */
public class Solution101 {
    public boolean isSymmetric(TreeNode root) {
        return check(root.left, root.right);
    }

    public boolean check(TreeNode p, TreeNode q) {
        if (p == null && q == null)
            return true;
        if (p == null || q == null)
            return false;
        return (p.val == q.val) && check(p.left, q.right) && check(p.right, q.left);

    }

}

